<template>
  <div class="app-container">
    <el-form ref="form" :model="tclass" label-width="120px">
      <el-form-item label="班级名称">
        <el-input v-model="tclass.classname" />
      </el-form-item>
      <el-form-item label="班级人数">
          <el-input v-model="tclass.classnum" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary"  @click="onSubmit">新增班级</el-button>
        <el-button @click="onCancel">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import request from '@/utils/request'
export default {
  data() {
    return {
      tclass: {
        classname: '',
        classnum: '',
      },
    }
  },
  methods: {
    onSubmit() {
      // 请求接口 实现用户新增接口的调用
      request({
        url:"/edu/tclass/save.do",
        method: "POST",
        data:this.tclass
      }).then(res=>{
        if(res.code==0){
          //跳转到列表页面
          this.$router.push("/classlist");
        }
      })
    },
    checkPass() {},
    onCancel() {
      this.$message({
        message: '取消班级的新增',
        type: 'warning'
      })
    }
  }
}
</script>

<style scoped>
.line{
  text-align: center;
}
</style>

